import java.lang.Throwable;

//public class Test1 {
//    public static void main(String[] args) {
//        int a = 2;
//        int b = 0;
//        System.out.println(a / b);
//    }
//}

public class Test1 {
    public static void main(String[] args) throws ArithmeticException, ArrayIndexOutOfBoundsException {
        int a = 4;
        int b = 0;
        int[] c = new int[]{1, 2, 3, 4, 5};

        try {
            System.out.println(a / b);
        } catch (ArithmeticException e) {
            e.printStackTrace();
        }
        finally {
            System.out.println("除数为0");
        }

        try {
            System.out.println(c[a + 1]);
        } catch (ArrayIndexOutOfBoundsException e) {
            e.printStackTrace();
        } finally {
            System.out.println("数组下标越界");
        }

        System.out.println("end");
    }
}
